1 /**
2 A module with tests to test the compile-time reflection
3 */
4
5 module unit_threaded.ut.modules.module_with_tests;
6
7 import unit_threaded.attrs;
8
9 version (unittest) {
10 import std.meta;
11 import unit_threaded.should;
12
13 //test functions
14 void testFoo() {
15 }
16
17 void testBar() {
18 }
19
20 private void testPrivate() {
21 } //should not show up
22 @UnitTest void funcThatShouldShowUpCosOfAttr() {
23 }
24
25 //non-test functions
26 private void someFun() {
27 }
28
29 private void testosterone() {
30 }
31
32 private void tes() {
33 }
34
35 //non-test non-functions
36 int testInt;
37
38 //test classes
39 class FooTest {
40 void test() {
41 }
42 }
43
44 class BarTest {
45 void test() {
46 }
47 }
48
49 @UnitTest class Blergh {
50 }
51
52 //non-test classes
53 class NotATest {
54 void tes() {
55 }
56 }
57
58 class AlsoNotATest {
59 void testosterone() {
60 }
61 }
62
63 @HiddenTest void withHidden() {
64 }
65
66 void withoutHidden() {
67 }
68
69 //other non-test members
70 alias seq = AliasSeq!(int, float, string);
71 }
72
73 unittest {
74 //1st block
75 assert(true);
76 }
77
78 unittest {
79 //2nd block
80 assert(true);
81 }
82
83 @Name("myUnitTest")
84 unittest {
85 assert(true);
86 }
87
88 struct StructWithUnitTests {
89 alias SelfSoDontRecurseForever = StructWithUnitTests;
90
91 @Name("InStruct")
92 unittest {
93 assert(false);
94 }
95
96 unittest {
97 // 2nd inner block.
98 assert(true);
99 }
100 }
101
102 // github issue #26 - template instance GetTypes!uint does not match template declaration
103 alias RGB = uint;
104
105 import unit_threaded : TestCase;
106
107 class Issue83 : TestCase {
108 this() {
109 }
110
111 override void test() {
112 }
113 }